package com.lognsoft.shell;

import java.util.Hashtable;

public class Plugin
{
	public static Plugin plugin = new Plugin();
	
	@SuppressWarnings("rawtypes")
	Hashtable<String,Class > _maps = 
		new Hashtable<String, Class >();
	
	public void AddClass (String className, String JARorPATH)
	{		
	}

	public void Add(String name, Class<?> cls)
	{
		if (cls == null)
		{
			return;
		}
		
		_maps.put(name, cls);
	}
	
	public int run(String name, String path, String[] args) throws Exception
	{
		Class<?> cls = _maps.get(name);
		
		if (cls == null)
		{
			return -1;
		}
		
		PluginObject obj = (PluginObject)cls.newInstance();
		
		return obj.run(path, args);
	}
};